/**
 * Copyright &copy; 2015-2020 <a href="http://www.easyhis.com/">easyhis</a> All rights reserved.
 */
package com.easy.dfcapi.entity;

import com.easy.common.utils.IdGen;
import com.easy.common.utils.excel.annotation.ExcelField;
import com.easy.core.persistence.BaseEntity;
import com.easy.modules.sys.entity.User;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 收货人的信息列表Entity
 * @author waylen chi
 * @version 2018-01-12
 */
public class ApiUserAddress extends BaseEntity<ApiUserAddress> {
	
	private static final long serialVersionUID = 1L;
	private Integer addressId;		// ID自增
	private String id;		// UUID
	private String addressName;		// 地址薄名称
	private Integer storeId;		// 店家Id
	private ApiUser user;		// 用户ID
	private String addressType;		// 1--收货地址 0--厂家发货地址
	private String consignee;		// 收货人的名字
	private String email;		// 收货人EMAIL
	private Integer country;		// 收货人的国家
	private Integer province;		// 收货人的省份
	private Integer city;		// 收货人的城市
	private Integer district;		// 收货人的区县
	private String address;		// 收货人的详细地址
	private String zip;		// 收货人的邮编
	private String phone;		// 收货人的电话
	private String mobile;		// 收货人的手机号
	private String signBuilding;		// 收货地址的标志性建筑名
	private String bestTime;		// 收货人的最佳收货时间
	private Integer isDefault;		// 是否默认
	
	public ApiUserAddress() {
		super();
	}

	public ApiUserAddress(String id){
		this.id = id;
	}

	@NotNull(message="ID自增不能为空")
	@ExcelField(title="ID自增", align=2, sort=0)
	@JsonIgnore
	public Integer getAddressId() {
		return addressId;
	}

	public void setAddressId(Integer addressId) {
		this.addressId = addressId;
	}
	
	@ExcelField(title="UUID", align=2, sort=1)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@ExcelField(title="地址薄名称", align=2, sort=2)
	public String getAddressName() {
		return addressName;
	}

	public void setAddressName(String addressName) {
		this.addressName = addressName;
	}
	
	@ExcelField(title="店家Id", align=2, sort=3)
	@JsonIgnore
	public Integer getStoreId() {
		return storeId;
	}

	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}
	
	@NotNull(message="用户ID不能为空")
	@ExcelField(title="用户ID", fieldType=User.class, value=".userName", align=2, sort=4)
	@JsonIgnore
	public ApiUser getUser() {
		return user;
	}

	public void setUser(ApiUser user) {
		this.user = user;
	}
	
	@ExcelField(title="1--收货地址 0--厂家发货地址", align=2, sort=5)
	public String getAddressType() {
		return addressType;
	}

	public void setAddressType(String addressType) {
		this.addressType = addressType;
	}
	
	@ExcelField(title="收货人的名字", align=2, sort=6)
	public String getConsignee() {
		return consignee;
	}

	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}
	
	@ExcelField(title="收货人EMAIL", align=2, sort=7)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@NotNull(message="收货人的国家不能为空")
	@ExcelField(title="收货人的国家", align=2, sort=8)
	public Integer getCountry() {
		return country;
	}

	public void setCountry(Integer country) {
		this.country = country;
	}
	
	@NotNull(message="收货人的省份不能为空")
	@ExcelField(title="收货人的省份", align=2, sort=9)
	public Integer getProvince() {
		return province;
	}

	public void setProvince(Integer province) {
		this.province = province;
	}
	
	@NotNull(message="收货人的城市不能为空")
	@ExcelField(title="收货人的城市", align=2, sort=10)
	public Integer getCity() {
		return city;
	}

	public void setCity(Integer city) {
		this.city = city;
	}
	
	@NotNull(message="收货人的区县不能为空")
	@ExcelField(title="收货人的区县", align=2, sort=11)
	public Integer getDistrict() {
		return district;
	}

	public void setDistrict(Integer district) {
		this.district = district;
	}
	
	@ExcelField(title="收货人的详细地址", align=2, sort=12)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@ExcelField(title="收货人的邮编", align=2, sort=13)
	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}
	
	@ExcelField(title="收货人的电话", align=2, sort=14)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@ExcelField(title="收货人的手机号", align=2, sort=15)
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	@ExcelField(title="收货地址的标志性建筑名", align=2, sort=16)
	public String getSignBuilding() {
		return signBuilding;
	}

	public void setSignBuilding(String signBuilding) {
		this.signBuilding = signBuilding;
	}
	
	@ExcelField(title="收货人的最佳收货时间", align=2, sort=17)
	public String getBestTime() {
		return bestTime;
	}

	public void setBestTime(String bestTime) {
		this.bestTime = bestTime;
	}
	
	@ExcelField(title="是否默认", align=2, sort=18)
	public Integer getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(Integer isDefault) {
		this.isDefault = isDefault;
	}


	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(){
		this.id = IdGen.uuid();

		//this.createTime = new Date();
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(){
	}
	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(Date now){
		this.id = IdGen.uuid();

		//this.createTime = now;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(Date now){
	}
}